fix: code quality and safety improvements - #749
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe backend changes the CORS allowlist check to use ChangesCORS validation
Activity fetch error handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
backend/server.jstypescript-eslint does not support TS 7.0. Oops! Something went wrong! :( ESLint: 9.39.5 Error: typescript-eslint does not support TS 7.0. src/components/ActivityFeed.tsxtypescript-eslint does not support TS 7.0. Oops! Something went wrong! :( ESLint: 9.39.5 Error: typescript-eslint does not support TS 7.0. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🎉 Thank you @saurabhhhcodes for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/ActivityFeed.tsx`:
- Around line 36-37: Update ActivityFeed’s fetch flow to track request errors
separately from the events list: when res.ok is false, set the error state and
render a failure message instead of “No activity found,” while preserving
loading cleanup. Add a regression case in ActivityFeed.test.tsx covering a
non-OK response and asserting the failure message is shown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 382e2aed-dd23-4ece-865d-3cd96c20dbb3
📒 Files selected for processing (2)
backend/server.jssrc/components/ActivityFeed.tsx
| if (!res.ok) throw new Error("Request failed"); | ||
| const data = await res.json(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Do not report HTTP failures as an empty feed.
When res.ok is false, the error reaches the catch block, which only clears loading. If events is empty, the component renders No activity found for a failed request. Add an error state and render a failure message instead. Add a regression test in src/components/ActivityFeed.test.tsx for a non-OK response.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/ActivityFeed.tsx` around lines 36 - 37, Update ActivityFeed’s
fetch flow to track request errors separately from the events list: when res.ok
is false, set the error state and render a failure message instead of “No
activity found,” while preserving loading cleanup. Add a regression case in
ActivityFeed.test.tsx covering a non-OK response and asserting the failure
message is shown.
Summary by CodeRabbit